package com.ygqh.baby.service.pay;

import com.foxinmy.weixin4j.payment.PayRequest;
import com.ygqh.baby.ao.Message;
import com.ygqh.baby.ao.PayType;

public class UnifiedOrderResult extends Message {
	/** 
	*/
	private static final long serialVersionUID = 4420498923857810292L;

	private String platformNo;

	private String platformName;

	private PayType payType;

	private PayRequest payRequest;

	private String orderInfo;

	private String errorMsg;

	public String getErrorMsg() {
		return errorMsg;
	}

	public void setErrorMsg(String errorMsg) {
		this.errorMsg = errorMsg;
	}

	public UnifiedOrderResult() {
		super();
	}

	public UnifiedOrderResult(PayType payType, String platformNo, String platformName) {
		super(Message.Type.success, Message.Type.success.name());
		this.payType = payType;
		this.platformNo = platformNo;
		this.platformName = platformName;
	}

	public static UnifiedOrderResult error(String content, String errorMsg) {
		UnifiedOrderResult res = new UnifiedOrderResult();
		res.setType(Message.Type.error);
		res.setContent(content);
		res.setErrorMsg(errorMsg);
		return res;

	}

	public String getPrepayId() {
		if (payRequest != null) {
			return payRequest.getPrepayId();
		}
		return "";
	}

	public String getPlatformNo() {
		return platformNo;
	}

	public void setPlatformNo(String platformNo) {
		this.platformNo = platformNo;
	}

	public String getPlatformName() {
		return platformName;
	}

	public void setPlatformName(String platformName) {
		this.platformName = platformName;
	}

	public PayType getPayType() {
		return payType;
	}

	public void setPayType(PayType payType) {
		this.payType = payType;
	}

	public PayRequest getPayRequest() {
		return payRequest;
	}

	public void setPayRequest(PayRequest payRequest) {
		this.payRequest = payRequest;
	}

	public String getOrderInfo() {
		return orderInfo;
	}

	public void setOrderInfo(String orderInfo) {
		this.orderInfo = orderInfo;
	}

}
